path.display())))
}
let name = path.filename_str().unwrap();
+ for c in name.chars() {
+ if c.is_alphanumeric() { continue }
+ if c == '_' || c == '-' { continue }
+ return Err(human(format!("Invalid character `{}` in crate name: `{}`",
+ c, name).as_slice()));
+ }
mk(&path, name, &opts).chain_error(|| {
human(format!("Failed to create project `{}` at `{}`",
name, path.display()))
dst.display())));
})
+test!(invalid_characters {
+ assert_that(cargo_process("new").arg("foo.rs"),
+ execs().with_status(101)
+ .with_stderr("Invalid character `.` in crate name: `foo.rs`"));
+})
+
test!(finds_author_user {
// Use a temp dir to make sure we don't pick up .cargo/config somewhere in
// the hierarchy